<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<LCA.Community.Web.Models.QuestionViewModel>>" %>
<%@ Import Namespace="LCA.Community.DAL.Model" %>
<%@ Import Namespace="LCA.Community.Web.Models" %>
<%@ Import Namespace="LCA.Community.Web.Controllers" %>
<%@ Import Namespace="Microsoft.Web.Mvc" %>
<%@ Import Namespace="System.Globalization" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
    
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="content-main">
        <h2><img src="<%= Url.Content("~/Content/images/FinalDesign/Icons/questionmark24.png") %>" />Preguntas</h2>
            <% foreach (QuestionViewModel questionViewModel in ViewData.Model){ %>
                <div class="post">
                    <h3><%= Html.ActionLink<QuestionsController>(q => q.Detail(questionViewModel.Question.RowKey), questionViewModel.Question.Title)%></h3>
                    <%= questionViewModel.Question.Body %>
                    <div class="post-foot">
                        <%= String.Format("<em>{0} respuestas</em>", questionViewModel.Answers.Count)%><br />
                        <%= String.Format("Escrito por {0} el {1} a las {2}", questionViewModel.Question.Author, questionViewModel.Question.Timestamp.ToString("D", new CultureInfo("es-ES")), questionViewModel.Question.Timestamp.ToString("T", new CultureInfo("es-ES")))%><br />
                        Tags: <%= questionViewModel.Question.Tags %><br />
                    </div>
                </div>
            <%} %>

        <div>
            <% if ((int)ViewData["page"] != 0){%>
            <%= Html.ActionLink("Anteriories", "Index", new { page = (int)ViewData["page"] - 1 }, new { @class = "pagination" })%>
            <% } %>
            <% if((bool)ViewData["more"]) { %>
            <%= Html.ActionLink("Siguientes","Index", new { page = (int)ViewData["page"] + 1 }, new { @class = "pagination" }) %>
            <%} %>
        </div>
    </div>
    
    <div class="content-right">
        <% Html.RenderPartial("QuestionMenu"); %>
    </div>
</asp:Content>

